package com.example.wechattakeaway.controller;

import com.example.wechattakeaway.service.AttentionService;
import com.example.wechattakeaway.vo.ResultVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@Api(value = "用户关注商家店铺",tags = {"用户商家关注信息管理"})
@RestController
@RequestMapping("/AttentionController")
public class AttentionController {

    @Autowired
    AttentionService attentionService;

    @ApiOperation(value = "用户新关注一个商家",notes = "微信小程序端接口")
    @PostMapping("/InsertUserAttention")
    public ResultVO InsertUserAttention(Integer userId,Integer merchantId){
        return attentionService.InsertUserAttention(userId, merchantId);
    }

    @ApiOperation(value = "用户查询自己关注的商家",notes = "微信小程序端接口")
    @PostMapping("/SelectAttentionByUser")
    public ResultVO SelectAttentionByUser(Integer pageNum,Integer userId){
        return attentionService.SelectAttentionByUser(pageNum,userId);
    }

    @ApiOperation(value = "根据id取消自己关注商家",notes = "微信小程序端接口")
    @PostMapping("/DeleteAttentionById")
    public ResultVO DeleteAttentionById( Integer attentionId){
        return attentionService.DeleteAttentionById(attentionId);
    }

}
